#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 1510;
vector<int> G[maxn];
int d[maxn][2];

void dfs(int u, int fa){
    d[u][0] = 0;
    d[u][1] = 1;
    for (auto v:G[u]) {
        if(v!=fa){
            dfs(v, u);
            d[u][1] += min(d[v][1], d[v][0]);
            d[u][0] += d[v][1];
        }
    }
}

int main() {
    int N;
    while (scanf("%d", &N) && N){
        for (int i = 0; i < N; ++i) {
            G[i].clear();
        }
        for (int i = 0; i < N; ++i) {
            int a, b, c;
            scanf("%d:(%d)", &a, &c);
            for (int j = 0; j < c; ++j) {
                scanf("%d", &b);
                G[a].push_back(b);
                G[b].push_back(a);
            }
        }
        dfs(0, 0);
        int ans = min(d[0][0], d[0][1]);
        printf("%d\n", ans);
    }

    return 0;
}